import React,{ Component } from 'react';
import Clock from './Clock';
import ReactDOM from 'react-dom';

class Index extends Component{
    constructor(){
        super();
        this.state={
            showClock:true
        }
    }
    handleShowOrHide(){
        this.setState({
            showClock : !this.state.showClock
        });
    }
    render(){
        return (
            <div>
                {this.state.showClock ? <Clock /> : null }
                <button onClick={this.handleShowOrHide.bind(this)}>显示或隐藏时钟</button>
            </div>
        );
    }
}

export default Index;

